<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>财务明细管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 
  <link rel="stylesheet" href="../../res/css/wholesale/font.css">
  <link rel="stylesheet" href="../../res/css/wholesale/xadmin.css">
  <link rel="stylesheet" href="../../res/layui/css/layui.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="../../res/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="../../res/js/wholesale/xadmin.js"></script>
</head>
<body>
<div class="demoTable" style="margin-top: 10px;">
    <div class="x-body">
    	<div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
			时间：
		    <input class="layui-input" placeholder="开始日" name="timaStart" id="timaStart" readonly>
		  -  
            <input class="layui-input" placeholder="截止日" name="timeEnd" id="timeEnd" readonly>
  <button class="layui-btn" data-type="reload" id="sous">搜索</button>
  </div>
  </div>
<table class="layui-table" lay-data="{url:'../../listenFinanceDetail/selectAll.action', page:true, id:'idTest'}" lay-filter="demo">
  <thead>
    <tr>
      <th lay-data="{field:'fdTime',align:'center' ,templet: '#fdTime'}">时间</th>
      <th lay-data="{field:'fdPrice', align:'center'}">金额</th>
      <th lay-data="{field:'fdNumber', align:'center'}">数量</th>
      <th lay-data="{field:'sort', align:'center'}">记录</th>
      <th lay-data="{field:'oper', align:'center'}">操作人</th>
    </tr>
  </thead>
</table>
 </div>
 </div>
<script src="../../res/js/wj/common.js" charset="utf-8"></script>
<script type="text/html" id="operationTime">
  {{ formatDate(d.openTime) }}  
</script>
<script type="text/html" id="fdTime">
  {{ formatDate(d.fdTime) }}  
</script>

<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use('laydate',function(){
	  var laydate = layui.laydate;
	   
	    laydate.render({
	      elem: '#timaStart'
	    });
	    laydate.render({
	        elem: '#timeEnd'
	      });
		 
	});
layui.use('laydate', function(){
    var laydate = layui.laydate;
    
    var end = laydate.render({
    	elem: '#timeEnd', //指定元素
    	done:function(value,date){
    		start.config.max={
   				year:date.year,
   				month:date.month-1,
   				date:date.date
    		}
    	}
    })
    
    var start = laydate.render({
    	elem: '#timaStart', //指定元素
    	done:function(value,date){
    		end.config.min={
   				year:date.year,
   				month:date.month-1,
   				date:date.date
    		}
    	}
    })
    
  //执行一个laydate实例
    laydate.render({
      elem: '#timaStart' //指定元素
    });

    //执行一个laydate实例
    laydate.render({
      elem: '#timeEnd' //指定元素
    });
    
  });  
layui.use('table', function(){
  var table = layui.table;
  
  //监听表格复选框选择
  table.on('checkbox(demo)', function(obj){
    console.log(obj)
  });
  //表单重载
  var $ = layui.$, active = {
		    reload: function(){
		    	var startTime = $('#timaStart');
			      var endTime = $('#timeEnd');
		      //执行重载    查询
		      table.reload('idTest', {
		        page: {
		          curr: 1 //重新从第 1 页开始
		        }
		        ,where: {
		        	 
		        	startTime: startTime.val(),
		        	endTime: endTime.val()
		        }
		      });
		    }
		  };
  
  
  $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
});
</script>
</body>
</html>